<script setup lang="ts">
import { useMessage } from 'naive-ui'
import { RouterView } from 'vue-router'
import type { IndexObj } from './types/commom'
import { getUnLoginSystemOptionList } from './api/systemOption'
;(window as IndexObj).$message = useMessage()
import useSettingsStore from '@/stores/modules/settings'

const settingsStore = useSettingsStore()
onMounted(() => {
  const title = document.querySelector('title')
  getUnLoginSystemOptionList()
    .then((res) => {
      title!.innerHTML = res.data.companyName
      settingsStore.setFormat(res.data.dataFormat)
    })
    .catch(console.error)
})
</script>

<template>
  <div class="app-con">
    <RouterView />
  </div>
</template>

<style scoped lang="scss">
.app-con {
  // 渐变tabs的下边框
  :deep(.n-tabs-bar) {
    border-radius: 4px;
    background: -webkit-linear-gradient(-200deg, #006cfa, #1acbff);
    height: 3px;
    box-shadow: 0 1px 4px rgba(24, 144, 255, 0.3);
  }

  // 数字计数器后缀穿透
  :deep(.n-input-number-suffix) {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    margin-right: 0;
    background: #fafafa;
    border: 1px solid #ddd;
    font-size: 12px;
  }

  // input的字体大小
  :deep(.n-form-item .n-form-item-label) {
    font-size: 13px;
  }
  :deep(.n-input__input-el) {
    font-size: 13px;
  }
  :deep(.n-input .n-input__placeholder) {
    font-size: 13px !important;
  }

  // textarea输入
  :deep(.n-input__textarea-el) {
    font-size: 13px;
  }

  // 面包屑
  :deep(.n-breadcrumb-item) {
    font-size: 13px;
  }

  // 选择器的字体大小
  :deep(.n-base-selection-placeholder__inner) {
    font-size: 13px;
  }

  :deep(.n-tree-select-menu) {
    font-size: 13px;
  }

  // alert警告信息字体大小
  :deep(.n-alert-body__content) {
    font-size: 13px;
  }

  :deep(.n-checkbox__label) {
    font-size: 13px;
  }

  // 树形展开
  :deep(.n-tree .n-tree-node) {
    box-sizing: border-box;
    height: 30px;
    align-items: center;
  }

  :deep(.n-tree-node-wrapper) {
    padding: 0;
  }

  :deep(.n-tree-node--selected) {
    border: 1px solid #99d1ff;
  }

  // 按钮组件字体大小
  // :deep(.n-button__content) {
  //   font-size: 13px;
  // }

  // 复选按钮组分割线不对其bug解决
  :deep(.n-radio-group .n-radio-group__splitor) {
    vertical-align: baseline;
  }

  // 复选款按钮组激活时样式修改
  :deep(.n-radio-group .n-radio-button.n-radio-button--checked) {
    color: var(--n-button-color-active);
    background: var(--n-button-text-color-active);
    border-color: var(--n-button-border-color-active);
  }

  :deep(.n-radio__label) {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
  }

  @media (max-width: 768px) {
    :deep(label) {
      margin: 0;
    }

    :deep(.n-radio-group .n-radio-group__splitor) {
      vertical-align: middle;
    }
  }
}
</style>
